<?php
namespace app\admin\validate;

use think\Validate;

class Admin extends Validate
{
    protected $rule = [
       'title'=>'require',
       'starttime'=>'require',
       'endtime'   =>'require'
    ];
    protected $message = [
    	'title.require'=>'活动名称不能为空',
        'endtime.require'=>'结束时间不能为空',
        'starttime.require'=>'开始时间不能为空',
    ];
    public function sceneLogin()
    {
        return $this->only(['username','password','code'])
            ->remove('username', 'unique');
    }
    public function sceneAdd()
    {
        return $this->only(['title','starttime']);
    }
    public function sceneEdit()
    {
        return $this->only(['username','password'])
            ->remove('password', 'require');
    }
}
